Imports System
Imports System.web
Imports System.Data
Imports System.Web.UI.WebControls
'Imports System.Configuration
Public Class add_product
    Inherits System.Web.UI.Page
    'Protected WithEvents TheHeader1 As adm_header
    Public aUserSession(13) As String
    Protected WithEvents upldphoto As System.Web.UI.WebControls.Button
    Protected WithEvents Reset As System.Web.UI.WebControls.Button
    Protected WithEvents subm As System.Web.UI.WebControls.Button
    Public msg As String
    Dim arrParamer(18) As String
    Public objvalid As New gaValidation
    Public imgpath, currtURL As String
    Protected WithEvents ProdNM As System.Web.UI.WebControls.TextBox
    Protected WithEvents ProdKW As System.Web.UI.WebControls.TextBox
    Protected WithEvents Proddetail As System.Web.UI.WebControls.TextBox
    Protected WithEvents ListingDsc As System.Web.UI.WebControls.TextBox
    Protected WithEvents TxtMiOrd As System.Web.UI.WebControls.TextBox
    Protected WithEvents currcy As System.Web.UI.WebControls.DropDownList
    Protected WithEvents country As System.Web.UI.WebControls.DropDownList
    Protected WithEvents port As System.Web.UI.WebControls.TextBox
    Dim strProdNM As String
    Dim strProdKW As String
    Dim strCategory As String
    Dim strProddetail As String
    Dim strListingDsc As String
    Dim strTxtMiOrd As String
    Dim strunitype As String
    Dim strcountry As String
    Dim strprodUnit As String
    Dim strProd_Time As String
    Dim strdeliverytm As String
    Dim strpackdetails As String
    Dim SourceIP, AuditServerIP As String
    Dim AuditServerTime As Date
    Protected WithEvents prodUnit As System.Web.UI.WebControls.DropDownList
    Protected WithEvents prodtime As System.Web.UI.WebControls.DropDownList
    Protected WithEvents deliverytm As System.Web.UI.WebControls.TextBox
    Protected WithEvents packdetails As System.Web.UI.WebControls.TextBox
    Protected WithEvents categoryList As System.Web.UI.WebControls.Button
    Dim oAddprod As gaMerchAccount.AdminTerminals
    'Dim ConnDNS As Configuration.appSettings("GASQLConnectionString")
#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents unitype As System.Web.UI.WebControls.DropDownList
    Protected WithEvents Dropdowntype2 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents Dropdownlist2 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents Dropdownlist3 As System.Web.UI.WebControls.DropDownList
    Protected WithEvents delivtm As System.Web.UI.WebControls.TextBox
    Protected WithEvents packdt As System.Web.UI.WebControls.TextBox

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        objValid.getURL(Request.Url.ToString, imgpath, currtURL)
    End Sub

    Private Sub Reset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Reset.Click

    End Sub

    Private Sub upldphoto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles upldphoto.Click

    End Sub

    Private Sub subm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles subm.Click
        'ProdNM.Text()
        'ProdKW.Text()
        'Category()
        'Proddetail()
        'ListingDsc()
        'TxtMiOrd()
        'unitype()
        'country()
        'prodUnit()
        'prodtime()
        'deliverytm()
        'packdetails()
        SourceIP = Request.ServerVariables("LOCAL_ADDRESS")
        AuditServerIP = Request.ServerVariables("")
        AuditServerTime = Now()
        arrParamer(0) = strProdNM
        arrParamer(1) = strProdKW
        arrParamer(2) = strCategory
        arrParamer(3) = strProddetail
        arrParamer(4) = strListingDsc
        arrParamer(5) = strTxtMiOrd
        arrParamer(6) = strunitype
        arrParamer(7) = strcountry
        arrParamer(8) = strprodUnit
        arrParamer(9) = strProd_Time
        arrParamer(10) = strdeliverytm
        arrParamer(11) = strpackdetails
        
        arrParamer(12) = SourceIP
        arrParamer(13) = AuditServerIP
        arrParamer(14) = AuditServerTime
        oAddprod = New gaMerchAccount.AdminTerminals
        oAddprod.DBConnectString = Application("DSN")
        'oAddprod.
    End Sub
    Private Function validate_dropbox(ByRef dropbox As DropDownList, ByVal intTp As Integer) As String
        Dim strValue As String = ""
        If dropbox.SelectedIndex > 0 Then
            strValue = dropbox.SelectedItem.Value
            arrParamer(intTp) = strValue

        Else
            Select Case intTp
                Case 1
                    msg = "Plese select a Merchant Type."
                Case 9
                    msg = "Please select a Country."
                Case 15
                    msg = "Please select a Member Type."
                Case 18
                    msg = "Please select a Resource."

            End Select

        End If

        If Len(strValue) > 0 And Len(msg) = 0 Then

            Return strValue
        Else
            'ErrMessage("Validate Dropdown box", msg)
            'CheckError(msg)
            Return msg
        End If
    End Function
    Private Function validate_inputtxt(ByRef txtbox As TextBox, ByVal intTp As Integer) As String
        Dim strText As String = ""

        If Len(txtbox.Text) > 0 Then
            strText = txtbox.Text
            arrParamer(intTp) = Trim(strText)
        Else
            Select Case intTp
                Case 2
                    msg = "Please enter your Company Name"
                Case 6
                    msg = "Please enter your Company Address"
                Case 7
                    msg = "Please enter your City Name"
                Case 10
                    msg = "Please enter your Zip Code"
                Case 8
                    msg = "Please enter your State Name"
                Case 3
                    msg = "Please enter your First name"
                Case 4
                    msg = "Please enter your Last Name"
                Case 11
                    msg = "Please enter your Telephone Number"
                Case 14
                    msg = "Please enter your Email Address"

            End Select

        End If
        If Len(strText) > 0 And Len(msg) = 0 Then
            Return strText

        Else
            'msg = "Please complete all information."
            Return msg
        End If

    End Function

    Private Sub categoryList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles categoryList.Click
        Dim url As String
        Dim ScriptStr As String
        Dim WindowProp As String
        WindowProp = """height=450px,width=305px,status=yes,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no"""
        url = """category.aspx"""
        ScriptStr = "<script language=javascript>window.open(" & url & ",null," & WindowProp & ",true) </script>"
        'Page.RegisterStartupScript("OpenReport", ScriptStr)
    End Sub
End Class
